package common.library.utils;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;

import common.library.activities.ApplyPermissionsActivity;
import common.library.models.Callback;
import lombok.var;

public class PermissionUtil {

    public static void apply(Activity activity, String[] permissions, Callback callback) {
        ApplyPermissionsActivity.permissions = permissions;
        ApplyPermissionsActivity.callback = callback;
        var intent = new Intent(activity, ApplyPermissionsActivity.class);
        activity.startActivity(intent);
    }

    public static void applyNormal(Activity activity, Callback callback) {
        apply(activity, new String[]{
                Manifest.permission.INTERNET,
                Manifest.permission.CAMERA,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.RECORD_AUDIO,
                Manifest.permission.READ_PHONE_STATE
        }, callback);
    }

    public static void applyCamera(Activity activity, Callback callback) {
        apply(activity, new String[]{Manifest.permission.CAMERA}, callback);
    }
}
